package com.wlc.rabbitmq.workqueue;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author 王立朝
 * @description 工作模式，消费者1
 * @date 2021-12-14 20:43:28
 */
@Component
public class WorkConsumers1 {

    /**
     *
     * @param message
     * @param channel
     * @throws IOException
     */
    @RabbitListener(queues = "work_queue")
    public void readMessage(Message message, Channel channel) throws IOException {
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        System.out.println("我是消费信息111：" + new String(message.getBody()));
    }
}
